package homework;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;

public class Work1 {

	public static void main(String[] args) {
		String urlStr = "http://hotels.ctrip.com/hotel/shanghai2#ctm_ref=hod_hp_sb_lst";
		BufferedReader reader = null;
		StringBuffer content = new StringBuffer();
		try {
			URL url = new URL(urlStr);
			reader = new BufferedReader(new InputStreamReader(url.openConnection().getInputStream()));
			String str = null;
			while ((str = reader.readLine()) != null) {
				content.append(str).append("\r\n");
			}
			System.out.println(content.toString());
		} catch (MalformedURLException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			try {
				if (reader != null) {
					reader.close();
				}
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
	}
}